function llh = loglh(nos, model, R)
k = model.k;
Sigma = model.Sigma;
w = model.weight;
U = model.U;
V = model.V;

[p,m] = size(nos);
X = reshape(nos - U*V',1,p*m);

logl = zeros(1,k);
for i = 1:k
    Si = Sigma(:,:,i);
    temp = -0.5 * Si^(-1) * X.* X;
    logl(i) = R(:,i)' * log( w(i)*((2*pi)^(-1/2)*det(Si)^(-1/2))*exp(temp') + eps);
end
llh = sum(logl)/(p*m);